import request from '@/utils/request'

//优惠券列表
export function getcouponList(data){
    return request({
        url: 'coupon',
        method: 'get',
        params:data,
        headers:{
          'showLoading':true
        }
      })
}

// 新增
export function createcoupon(data){
    return request({
        url: 'coupon/create',
        method: 'post',
        data:data
      })
}


// 详情
export function getreadInfo(data){
    return request({
        url: 'coupon/read',
        method: 'get',
        params:data,
        headers:{
          'showLoading':false
        }
      })
}

//编辑

export function editupdate(data){
    return request({
        url: 'coupon/update',
        method: 'put',
        data:data,
        headers:{
          'showLoading':false
        }
      })
}


// 切换首页展示
export function changeshow(data){
    return request({
        url: 'coupon/updateisshow',
        method: 'put',
        data:data,
        headers:{
          'showLoading':false
        }
      })
}

// 切换状态
export function changeState(data){
    return request({
        url: 'coupon/updatestatus',
        method: 'put',
        data:data,
        headers:{
          'showLoading':false
        }
      })
}

//删除
export function deleteitem(data){
  return request({
      url: 'coupon/delete',
      method: 'delete',
      data:data
    })
}

//领取记录
export function getrecord(data){
  return request({
      url: 'coupon/history',
      method: 'get',
      params:data
    })
}

//获取免费试学
export function gettrylearnconfig(data){
  return request({
     url: 'coupon/tryfreeconfig',
     method:'get',
     params:data,
     headers:{
       'showLoading':false
     }
  })
}

// 免费试学

export function trylearnconfig(data){
  return request({
     url: 'coupon/tryfreeconfig',
     method:'put',
     data,
     headers:{
       'showLoading':false
     }
  })
}

//推荐好友 配置详情
export function recommendconfig(data){
  return request({
     url: 'coupon/recommendconfig',
     method:'get',
     params:data,
     headers:{
       'showLoading':false
     }
  })
}



//推荐好友 修改配置
export function edittrylearnconfig(data){
  return request({
     url: 'coupon/recommendconfig',
     method:'put',
     data,
     headers:{
       'showLoading':false
     }
  })
}
//推荐好友获取优惠券
export function couponoption(data){
  return request({
     url: 'coupon/option',
     method:'get',
       params:data,
     headers:{
       'showLoading':false
     }
  })
}

//活动设置
export function activitysettingRule(data){
  return request({
     url: 'activity/settingRule',
     method:'post',
     params:data,
     headers:{
       'showLoading':false
     }
  })
}
//关闭活动
export function activitycloseActivity(data){
  return request({
     url: 'activity/closeActivity',
     method:'put',
     params:data,
     headers:{
       'showLoading':false
     }
  })
}
//设置优惠券
export function packageupdatecoupon(data){
  return request({
     url: 'package/updatecoupon',
     method:'put',
     params:data,
     headers:{
       'showLoading':false
     }
  })
}
//设置优惠券(班型)状态
export function packageupdatecouponstate(data){
  return request({
     url: 'package/updatecouponstate',
     method:'put',
     params:data,
     headers:{
       'showLoading':false
     }
  })
}
